package co.fitstart.market.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dynamic;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;

import co.fitstart.entity.market.InvitationStatus;
import co.fitstart.entity.market.MarketInvitationRecord;

@Dynamic("hibernate")
public interface MarketInvitationRecordDao {
    
    /**
     * 
     * @param inviter
     * @param status
     * @return
     */
    @Query("FROM MarketInvitationRecord WHERE inviter = :inviter AND status = :status")
    public List<MarketInvitationRecord> list(@Variable("inviter") String inviter, @Variable("status") InvitationStatus status);
    
    /**
     * 
     * @param invitee
     * @param status
     * @return
     */
    @Query("FROM MarketInvitationRecord WHERE invitee = :invitee AND status = :status ORDER BY createTime ASC")
    public MarketInvitationRecord load(@Variable("invitee") String invitee, @Variable("status") InvitationStatus status);

}
